/*
 * @Autor: dingxiaolin
 * @Date: 2021-04-09 14:25:14
 * @LastEditors: dingxiaolin
 * @LastEditTime: 2021-05-24 12:15:15
 */
import { createStore } from 'vuex'
import createPersistedState from "vuex-persistedstate";
// https://vitejs.dev/guide/features.html#glob-import
const modulesFiles = import.meta.globEager('./modules/*.ts')
let modules = {} as any;

for (const path in modulesFiles) {
    const moduleName = path.replace(/(.*\/)*([^.]+).*/gi, '$2') as any
    modules[moduleName] = modulesFiles[path]['default']
}
Object.keys(modules).forEach((key) => {
    modules[key]['namespaced'] = true
})
const store = createStore({
    state: {
        jwtToken: "",
        catch_components: [''],
    },
    mutations: {

    },
    actions: {
    },
    modules,
    plugins: [createPersistedState({ storage: window.localStorage })],
})
export default store




